<?php /* Smarty version 2.6.14, created on 2015-03-24 09:54:55
         compiled from gamepay.index.html */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<form action="<?php echo $this->_tpl_vars['formAction']; ?>
" method="POST" <?php if ($this->_tpl_vars['is_validator']): ?> id="adminform" onsubmit="return Validator.Validate(this)" <?php endif; ?>>
<link rel="stylesheet" type="text/css" href="<?php echo @BASEURI; ?>
public/css/ui.datepicker.css"/>
<script language="javascript" src="<?php echo @BASEURI; ?>
public/js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo @BASEURI; ?>
public/css/jquery.autocomplete.css"/>
<style type="text/css">
table div{
	float:left;
	margin:3px auto 6px auto;
	padding:0px;
}
#search tr{
	line-height:120%;
	margin:0px;
	padding:0px;
}

select{
    height:23px;
}
</style>
<script language="javascript" src="<?php echo @BASEURI; ?>
public/js/ui.datetimepicker.js"></script>
<script language="javascript" type="text/javascript">
var server	=	'<?php echo $this->_tpl_vars['servers']; ?>
';  // 服务器信息数组
var gcode = '<?php echo $this->_tpl_vars['s']['game_id']; ?>
';      // 当前选中游戏
var sel_server = "<?php echo $this->_tpl_vars['s']['server_id']; ?>
"; // 当前选中游戏服务区
var gsname;
$(document).ready(function(){
    server = eval('('+server+')');
	gsname = document.getElementById("server");
	if(gcode != ''){
		gsname.options.length = 0;
		gsname.options.add(new Option("--请选择--",""));
		for (i in server[gcode]){
			var s	=	new Option(server[gcode][i],i);
			if(i == sel_server)
			s.selected = 'selected';
			gsname.options.add(s);
		}
	}
});

function gameChange(v){
    	gcode = v;
		gsname.options.length = 0;
		gsname.options.add(new Option("--请选择--",""));
		for (var i in server[gcode]){
			gsname.options.add(new Option(server[gcode][i],i));
		}
		if(!server[gcode]){
			gsname.options.add(new Option("--请选择--",""));
			return false;
		}
}
function makeexcel(){
	if(confirm('确认导出excel数据表？')){
	//var host	= window.location.host;
        $("#excel").val(1);
	    submitform('<?php echo @BASEURI; ?>
gamepay/index/<?php echo $this->_tpl_vars['str']; ?>
',false);
	}
}
function selectData(){
     submitform('<?php echo @BASEURI; ?>
gamepay/index',false);
}
</script>
<table border="0" class="search" cellspacing="0" id="search">
   	<tr>
    	<td class="searchlogo"></td>
        <td>

            充值游戏:
            <input type="text" name="country" id="selectGame" value="<?php echo $this->_tpl_vars['games'][$this->_tpl_vars['s']['game_id']]; ?>
" />
            <input type="text" name="s[game_id]" id="gamess" value="<?php echo $this->_tpl_vars['s']['game_id']; ?>
" style="display: none"/>
            <!--游戏服务区:
            <select name="s[server_id]" id="server" style="width:150px">
                <option value='' >-请选择-</option>
            </select>-->
            统计日期:<input class="text" style="width:150px" type="text" name="s[time_start]" id="cdate_s"  value="<?php echo $this->_tpl_vars['s']['time_start']; ?>
"/>到
            <input class="text" style="width:150px" type="text" name="s[time_end]" id="cdate_e"  value="<?php echo $this->_tpl_vars['s']['time_end']; ?>
"/>
            <input type="button" class="button" name="ng" onclick="selectData()" value="查看" />
            <?php if ($this->_tpl_vars['exceed']): ?><span style="color:#f86300"> <b>单游戏按天实时查看数据报表最大支持选择日起结束前七天</b></span><?php endif; ?>
            <input type="hidden" name="excel" id="excel" value="" />
     	</td>
    </tr>
    <!--<tr>
    	<td>&nbsp;</td><th><p><?php echo $this->_tpl_vars['platformName']; ?>
</p></th>
    </tr>-->
</table>
<table width="100%" border="0" class="adminlist" cellspacing="0">
<?php if ($this->_tpl_vars['type'] == 3): ?>
<thead>
  <tr>
    <th>游戏服务区</th>
    <th>当天充值人数</th>
    <th>当天充值金额</th>
    <th>前一天同一时段充值人数</th>
    <th>前一天同一时段充值</th>
    <th>前一天总充值人数</th>
    <th>前一天总充值</th>
  </tr>
  </thead>
    <tbody id="showInfo">
  <tr class="row0">
   	<td><?php echo $this->_tpl_vars['serverList'][$_POST['s']['server_id']]; ?>
</td>
    <td><?php echo $this->_tpl_vars['today']['count']; ?>
</td>
    <td><?php echo $this->_tpl_vars['today']['sum']; ?>
</td>
    <td><?php echo $this->_tpl_vars['yesCurrent']['count']; ?>
</td>
    <td><?php echo $this->_tpl_vars['yesCurrent']['sum']; ?>
</td>
    <td><?php echo $this->_tpl_vars['yestoday']['count']; ?>
</td>
    <td><?php echo $this->_tpl_vars['yestoday']['sum']; ?>
</td>
  </tr>
 </tbody>
<?php else: ?>
    <thead>
      <tr>
        <th>游戏名称</th>
        <th>总新增用户</th>
        <th>新增用户</th>
        <th>平台老用户</th>
        <th>新增设备</th>
        <th>充值人数</th>
        <th>充值金额</th>
        <?php if ($this->_tpl_vars['type'] == 2): ?><th>日期</th><?php endif; ?>
      </tr>
      </thead>
        <tbody id="showInfo">
          <tr>
              <td><span style="color:#f86300">全部</span></td>
              <td><span style="color:#f86300"><?php echo $this->_tpl_vars['addUserTot']+$this->_tpl_vars['oldUserTot']; ?>
</span></td>
              <td><span style="color:#f86300"><?php echo $this->_tpl_vars['addUserTot']; ?>
</span></td>
              <td><span style="color:#f86300"><?php echo $this->_tpl_vars['oldUserTot']; ?>
</span></td>
              <td><span style="color:#f86300"><?php echo $this->_tpl_vars['adddeviceTot']; ?>
</span></td>
              <td><span style="color:#f86300"><?php echo $this->_tpl_vars['sum']['count']; ?>
</span></td>
              <td><span style="color:#f86300"><?php echo $this->_tpl_vars['sum']['sum']; ?>
</span></td>
              <?php if ($this->_tpl_vars['type'] == 2): ?><td>&nbsp;</td><?php endif; ?>
          </tr>
         <?php $_from = $this->_tpl_vars['result']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['info']):
?>
          <tr class="row0">
            <td><a href="/datasummary/show/game_id/<?php echo $this->_tpl_vars['info']['game_id']; ?>
"><?php echo $this->_tpl_vars['gameList'][$this->_tpl_vars['info']['game_id']]; ?>
</a></td>
            <td><?php echo $this->_tpl_vars['addUser'][$this->_tpl_vars['info']['game_id']]['addUser']+$this->_tpl_vars['addUser'][$this->_tpl_vars['info']['game_id']]['oldUser']; ?>
</td>
            <td><?php echo $this->_tpl_vars['addUser'][$this->_tpl_vars['info']['game_id']]['addUser']; ?>
</td>
            <td><?php echo $this->_tpl_vars['addUser'][$this->_tpl_vars['info']['game_id']]['oldUser']; ?>
</td>
            <td><?php echo $this->_tpl_vars['addUser'][$this->_tpl_vars['info']['game_id']]['addDevice']; ?>
</td>
            <td><?php echo $this->_tpl_vars['info']['count']; ?>
</td>
            <td><?php echo $this->_tpl_vars['info']['sum']; ?>
&nbsp;</td>
            <?php if ($this->_tpl_vars['type'] == 2): ?><td><?php echo $this->_tpl_vars['info']['time']; ?>
&nbsp;</td><?php endif; ?>
          </tr>
         <?php endforeach; endif; unset($_from); ?>

      </tbody>
<?php endif; ?>

  <tfoot>
      <tr>
        <td colspan="9"><input type="button" class="button" onclick="makeexcel()" value="导表" /></td>
      </tr>
  </tfoot>

</table>
</form>

<?php if ($this->_tpl_vars['s']['game_id']): ?>
<div id="chartArea" style="height:300px;border:1px solid #ccc;padding:10px;"></div>
<?php endif; ?>
<script language="javascript">

    $("#selectGame").autocomplete("/game_manager/search",{
        max: 10,//显示数据条数
        minChars:1, //在触发autoComplete前用户至少需要输入的字符数 默认为0 在输入框内双击或者删除输入框内内容时显示列表
        matchCase:false,
        matchContains:true,
        //matchContains: "word",//只要包含输入字符就会显示提示
        autoFill:false,//自动填充输入框
        scroll:false,//不显示滚动条
        parse: function(data){
            var rows = [];
            var d = eval(data);
            for(var i=0; i<d.length; i++){
                rows[rows.length] = {
                    data:d[i], //每条数据对象
                    value:d[i].name, //与输入的值比较的数据
                    result:d[i].name  //选中的实际数据
                };
            }
            return rows;
        },
        formatItem: function(row, i, max) {
            console.log(row);
            return   "<span class='ac_name'>"+row.name + "</span>";
        },
        formatMatch: function(row, i, max) {
            return row.name + " " + row.game_id;
        },
        formatResult: function(row) {
            return row.name;
        }
    }).result(function(event, row, formatted) {
        $("#gamess").val(row.game_id);
    });

    $('#addtime_s').datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"",maxDate:"0"});
	$('#addtime_e').datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"",maxDate:"0"});
	$('#cdate_s').datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"",maxDate:"0"});
	$('#cdate_e').datetimepicker({dateFormat:"yy-mm-dd",timeFormat:"",maxDate:"0"});
	$('#ctime_s').datetimepicker({dateFormat:"yy-mm-dd hh:00",timeFormat:"",maxDate:"+1d"});
	$('#ctime_e').datetimepicker({dateFormat:"yy-mm-dd hh:00",timeFormat:"",maxDate:"+1d"});
</script>

<?php echo $this->_tpl_vars['line']; ?>